<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>
        编写函数，求圆的面积
    </p>
    <input type="text" placeholder="请输入圆的半径">
    <input type="button" value="计算" onclick="getResult()">
    <span id="span">结果</span>
    <script>
        function getResult() {
            let radius = document.querySelector('input').value;
            let area = radius * radius * Math.PI;
            document.getElementById('span').innerHTML = area;
        }
    </script>
</body>

</html>